<?php
namespace app\app\controller;
use \app\app\controller\Base;
use \think\Db;
class News extends Base
{
    public function index()
    {
        $where=[];
        if(Request()->has('type')) $where=["type"=>Request()->param('type')];
        
		$news=Db::name("news")->where($where)->order(["sort"=>"asc","id"=>"desc"])->paginate(6);
		$this->assign("news",$news);
		$this->assign("page",$news->render());
		// var_dump($news->render());
        return $this->fetch();
    }

    //新闻详情页
    public function info(){
    	// 新闻
        $news=Db::name('news')->where('id',$this->request->param('id'))->find();
        $this->assign('news',$news);
    	// $this->assign('menu','3');
    	// $this->assign('_title',"新s闻详情");
        return $this->fetch();
    }
}
